﻿#region COPYRIGHT
//--------------------------------------------------------------------------------
// <copyright file="GuiManagerComponent.cs" company="starLiGHT Entertainment Studios">
//    Copyright (c) 2011 
//       Roland Rosenkranz (Glatzemann@email.de)
// </copyright>
// <license>
//   This file is part of starLiGHT.GUI.
//
//   It is released under the Microsoft Public License (Ms-PL).
//
//   You should have received a copy of the Microsoft Public License
//   along with starLiGHT.GUI. If not, see http://sle.codeplex.com/license.
//    
//   ADDITIONAL (commercial) LICENSES for starLiGHT.GUI are available on request.
// </license>
// <version>
// **************[ starLiGHT.Engine SVN ]**********************
// * $Rev:: 9870                  $:  Revision of last commit *
// * $Author:: unknown            $:  Author of last commit   *
// * $Date:: 2011-05-07 14:37:05 #$:  Date of last commit     *
// ************************************************************
// </version>
//--------------------------------------------------------------------------------
#endregion

namespace starLiGHT.GUI
{
    #region Using Statements
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Text;
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Content;
    using Microsoft.Xna.Framework.Graphics;
    using Microsoft.Xna.Framework.Input;
    using starLiGHT.Collections;
    using starLiGHT.GUI.Widgets;
    #endregion

    public sealed class GuiManagerComponent : DrawableGameComponent
    {
        #region Private Members
        private GuiManager guiManager;
        #endregion

        public GuiManagerComponent(Game game, string skinFileName)
            : base(game)
        {
            if (game == null)
            {
                throw new ArgumentNullException("game");
            }

            if (string.IsNullOrEmpty(skinFileName))
            {
                throw new ArgumentNullException("skinFileName", "a filename for the skin to be loaded is mandatory");
            }

            this.guiManager = new GuiManager(game, skinFileName);
        }

        public GuiManager GuiManager
        {
            get
            {
                return this.guiManager;
            }
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            this.guiManager.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            this.guiManager.Draw(gameTime);
        }

        protected override void LoadContent()
        {
            base.LoadContent();

            this.guiManager.LoadSkin();
        }

        protected override void UnloadContent()
        {
            base.UnloadContent();
            this.guiManager.UnloadContent();
        }
    }
}
